package com.qcc.cashier;
import com.google.gson.*;
import com.qcc.cashier.utils.StringUtils;


public class YdkConfig {
    private  static JsonObject config;
    static void setup(String ydkConfig) {
        config = new JsonParser().parse(ydkConfig).getAsJsonObject();
    }
    public static <T> T getConfig(Class<T> cls, String nodeName) {
        JsonObject node;
        if (StringUtils.isEmpty(nodeName)) {
            node = new JsonObject();
        } else {
            node = config.getAsJsonObject(nodeName);
        }

        return new Gson().fromJson(node, cls);

    }
}
